import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'home',
        component: () => import(/* webpackChunkName: "demo" */ '../views/EhomeView.vue'),
        redirect: '/login',
        children: [
            {
                //path中的内容为我们要输入浏览器的路径，或者请求服务器的路径
                path: '/index',
                component: () => import(/* webpackChunkName: "demo" */ '../views/eui/EIndexView.vue')
            },
            {
                path: '/dept',
                component: () => import(/* webpackChunkName: "demo" */ '../views/eui/dept.vue')
            },
            {
                path: '/emp',
                component: () => import(/* webpackChunkName: "demo" */ '../views/eui/emp.vue')
            },
            {
                path: '/disciple',
                component: () => import(/* webpackChunkName: "demo" */ '../views/eui/disciple.vue')
            },


        ]
    },

    {
        path: '/ehome',
        name: 'ehome',
        component: () => import(/* webpackChunkName: "demo" */ '../views/EhomeView.vue'),
        /*重定向使得菜单栏最开始打开的时候指向哪一个children*/
        redirect: '/ehome/index',
    },
    {
        path: '/login',
        component: () => import(/* webpackChunkName: "demo" */ '../views/LoginView.vue')
    },
    {
        path: '/404',
        component: () => import(/* webpackChunkName: "demo" */ '../views/404.vue')
    },


]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
